package com.atguigu.cloud.user.block;

import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.atguigu.cloud.user.entity.User;
import lombok.extern.slf4j.Slf4j;

import java.util.List;
import java.util.Map;

/**
 * @author LT
 * @create 2023-11-16-15:18
 */
@Slf4j
public class SentinelBlockHandler {

    public static String test1(String username, String password, BlockException blockException){
        log.error("资源访问限制：{},{},异常信息：{}",username,password,blockException.getMessage());
        return "success-test1_block_dead";
    }

    public static String test2(User user,BlockException blockException){
        log.error("资源访问限制：{},异常信息：{}",user.getUserName(),blockException.getMessage());
        return "success-test2_block_dead";
    }

    public static String test3(Map user,BlockException blockException){
        log.error("资源访问限制,异常信息：{}",blockException.getMessage());
        return "success-test3_block_dead";
    }

    public static String test4(List<Long> ids,BlockException blockException){
        log.error("资源访问限制：{},异常信息：{}",ids.size(),blockException.getMessage());
        return "success-test4_block_dead";
    }

    public static String test5(User user,BlockException blockException){
        log.error("资源访问限制：{},{}异常信息：{}",user.getUserName(),user.getId(),blockException.getMessage());
        return "success-test5_block_dead";
    }

    public static String test6(String token,BlockException blockException){
        log.error("资源访问限制：{},异常信息：{}",token,blockException.getMessage());
        return "success-test6_block_dead";
    }
}
